﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page 
{
    //public string ServerURL = "localhost:1588";
    public string ServerURL = "localhost:63451";
    protected void Page_Load(object sender, EventArgs e)
    {
        //카테고리 초기화
        //1. DB INSERT Setting
        SqlConnection sqlConn = new SqlConnection();
        sqlConn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString;

        SqlDataAdapter sqldap = new SqlDataAdapter();
        sqldap.SelectCommand = new SqlCommand();
        sqldap.SelectCommand.Connection = sqlConn;

        DataSet ds = new DataSet();
        
        sqldap.SelectCommand.CommandText = "SELECT * FROM UCCLIGHT Order by UCCIdx desc";

        sqldap.Fill(ds);
        lvList.DataSource = ds.Tables[0];
        lvList.DataBind();
    }
    int temp = 0;
    protected String SetLink()
    {

        temp++;
        if (Int32.Parse(Eval("UCCEncodingOption").ToString()) == 1)
        {
            return String.Format("<a href='Read.aspx?uccidx={0}'><img src='http://{1}{2}' alt=''  style='' width='200px' height='160px' border= '0' /></a></div>"
                     , Eval("uccidx")
                        , ServerURL
                        , Eval("UCCImage"));

        }
        else
        {
            return String.Format("<img src='http://{0}{1}' alt=''  style='' width='200px' height='160px' onclick='alert(\"동영상 인코딩이 아직 완료되지 않았습니다.\")' style='cursor:pointer;'/></div>"
                , ServerURL
                , Eval("UCCImage"));
        }

    }
    protected void btnNew_Click(object sender, EventArgs e)
    {
        Response.Redirect("Write.aspx");
    }
}
